################################################################################
###########11.Figure_A1.R#######################################################
################################################################################

#####Relationship between Salience and Issue Position#####
pols <- readRDS('pols_bjps')
#####Relationship between Issue Salience and Polarization#####

library(readxl)
ches <- read_excel("C:/Users/gunde/Dropbox/Volatility/Party Brands and Volatility/data/Chapel Hill Expert Survey/1999-2014_CHES_dataset_means.xlsx")

library(ggplot2)

party_system <- ggplot(pols, aes(x = scale_socioeconomicsal, y = scale_econsdw)) + 
  geom_point() + 
  geom_smooth(method = 'lm', color = 'black') +
  theme_bw() +
  labs(x = '',
       y = 'Polarization on Economic Dimension',
       title = 'A. Party System Level')

summary(lm(scale_econsdw ~ scale_socioeconomicsal, data = pols)) #Not significant

library(haven)
ches <- read_dta("CHES Data/1999-2014_CHES_dataset_means-3.dta")

party_level <- ggplot(ches, aes(x = lrecon_salience, y = lrecon, size = vote)) + 
  geom_point() + 
  theme_bw() +
  labs(x = "", y = "Economic Position",
       title = 'B. Party Level',
       size = "Vote Share")

library(gridExtra)
between <- grid.arrange(party_system, party_level, nrow = 1, top = "", left = "", bottom = "Salience of Economic Issues")

#Save the Plot

#ggsave("figure_A1.pdf, plot = between, width = 11, height = 5, units = 'in')